<html>
<head>
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.common.tooltips.js" ></script>
    <script src="../libraries/RGraph.common.effects.js" ></script>
    <script src="../libraries/RGraph.drawing.poly.js" ></script>
    <script src="../libraries/RGraph.line.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->
    
    <title>A 'stacked' range Line chart</title>
    
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A range chart with the data such that the datasets appear to be stacked range sections." />
     
</head>
<body>

    <h1>A 'stacked' range Line chart</h1>
    
    <p>
        This is an example of how you can manipulate the data that you give to a range chart so that you get a stacking
        effect. There are actually three line charts here - one on top of the other.
    </p>

    <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>


    <script>
        $(document).ready(function ()
        {
            var data = [[3,5,6,7,4,8,5,9,13,14,16,15,17,18,19,21,24,25,25,26,28,28,27,26,25,25]];
            
            for (var j=1; j<6; j+=2) {
                data[j]   = [];
                data[j+1] = [];
                for (var i=0,len=data[0].length; i<len; i+=1) {
                    data[j][i] = data[0][i] + (2 * j);
                    data[j+1][i] = data[0][i] + (2 * j);
                }
            }

            var line = new RGraph.Line({
                id: 'cvs',
                data: [data[0], data[1]],
                options: {
                    fillstyle: 'red',
                    filled: {
                        self: true,
                        range: true
                    },
                    colors: ['rgba(0,0,0,0)'],
                    linewidth: 1,
                    ymax: 50,
                    numxticks: 25,
                    background: {
                        grid: {
                            autofit: {
                                numvlines: 25
                            }
                        }
                    },
                    gutter: {
                        bottom: 50
                    },
                    tickmarks: null
                }
            }).draw()

            var line = new RGraph.Line({
                id: 'cvs',
                data: [data[2], data[3]],
                options: {
                    fillstyle: '#0c0',
                    filled: {
                        self: true,
                        range: true
                    },
                    colors: ['rgba(0,0,0,0)'],
                    linewidth: 1,
                    ymax: 50,
                    numxticks: 25,
                    background: {
                        grid: false
                    },
                    gutter: {
                        bottom: 50
                    },
                    tickmarks: null
                }
            }).draw()

            var line = new RGraph.Line({
                id: 'cvs',
                data: [data[4], data[5]],
                options: {
                    fillstyle: '#66f',
                    filled: {
                        self: true,
                        range: true
                    },
                    colors: ['rgba(0,0,0,0)'],
                    linewidth: 1,
                    ymax: 50,
                    numxticks: 25,
                    background: {
                        grid: false
                    },
                    gutter: {
                        bottom: 50
                    },
                    tickmarks: null
                }
            }).draw()


            var line = new RGraph.Line({
                id: 'cvs',
                data: [4,7,8,5,4,6,8,9,12,18,19,17,19,21,22,25,24,26,27,29,28,27,29,33,35,37],
                options: {
                labels: ['12th','\r\n13th','14th','\r\n15th','16th','\r\n17th','18th','\r\n19th','20th','\r\n21st','22nd','\r\n23rd','24th','\r\n25th','26th','\r\n27th','28th','\r\n29th','30th','\r\n31st','1st','\r\n2nd','3rd','\r\n4th','5th','\r\n6th'],
                    colors: ['black'],
                    linewidth: 3,
                    ymax: 50,
                    numxticks: 0,
                    background: {
                        grid: false
                    },
                    gutter: {
                        bottom: 50
                    },
                    tickmarks: null
                }
            }).draw()
        })
    </script>

    <p>
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>

